home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / RLaB / help / STRING < prev    next >
Text File  |  1994-04-25  |  2KB  |  69 lines

  1. STRING:
  2.  
  3.     Strings are the equivalent of C string constants (or string
  4.     literals). Strings are entered from the command line like:
  5.  
  6.     > str = "Sample String"
  7.     Sample String
  8.  
  9.     The show command reveals the attributes associated with each
  10.     string. 
  11.  
  12.     > show ( str )
  13.        name:      str     
  14.        class:     string  
  15.         type:             
  16.          nr:      1       
  17.          nc:      1       
  18.  
  19.     The information can also be obtained, by referencing the
  20.     object members.
  21.  
  22.     > str.class
  23.     string
  24.     > str.l
  25.               13
  26.  
  27.     Strings are always enclosed in `"'. Single quotes, either
  28.     forward or backward have no special meaning in RLaB.
  29.  
  30.     Strings can contain escape characters;
  31.  
  32.     `\n'    newline
  33.     `\t'    tab
  34.     `\f'    formfeed    
  35.     `\b'    backspace
  36.     `\r'    carriage return
  37.     `\a'    alert (bell)
  38.     `\v'    vertical tab
  39.     `\\'    backslash
  40.     `\''    single quote
  41.     `\"'    double quote
  42.  
  43.     Strings can be concatenated using the addition operator (`+').
  44.     Since you cannot break a string across lines you can:
  45.  
  46.     "Entering a really long string, with more to go. " + ...
  47.     "Now type in the rest of it... "
  48.  
  49.     The above will produce a single string.
  50.  
  51.     Strings can be used to form matrices, in the same way the
  52.     numeric values can form a numeric matrix:
  53.  
  54.     > strm = [ "str11", "str12";
  55.     >          "str21", "str22"]
  56.      strm =
  57.     str11  str12  
  58.     str21  str22  
  59.  
  60.     The elements of a string matrix do not need to be the same
  61.     length. The output from what() is a good example.
  62.     
  63.     Scalar strings cannot be mixed with numeric scalars in the
  64.     same matrix. Lists provide a good method of mixing string and
  65.     numeric data.
  66.  
  67.     The built-in function strsplt() is provided to split a string
  68.     scalar into individual characters. 
  69.